/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Vehicle_vs2;

/**
 *
 * @author Root
 */
class Vehicle {

    double load, maxLoad;

    public void setMaxLoad(double maxLoad) {
        this.maxLoad = maxLoad;
    }

    public double getLoad() {
        return load;
    }

    public double getMaxLoad() {
        return maxLoad;
    }
    int i = 1;

    public void addBox(double weight) {
        System.out.println("Add box #" + i + "(" + weight + "kg): " + addbox(weight));
        if (!addbox(weight)) {

            i++;
        } else {
            i++;
            load += weight;
        }
    }

    public boolean addbox(double weight) {
        double a = load + weight;
        if (a > maxLoad) {
            return false;

        } else {
            return true;
        }

    }
    public void show_load(){
        System.out.println("vehicle load is "+load+" kg");
    }
    public void show_Max_load(){
        System.out.println("Creating a vehicle with  "+maxLoad+" kg maximum load ");
    }

    public Vehicle(double maxLoad) {
        this.maxLoad = maxLoad;
    }

}
